{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
<input type="hidden" name='id' id='id' value="{$info.id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row">
				<div class="col-sm-12">
				<!-- form start -->
					<div class="form-group type">
						<label class="col-sm-2 control-label">类型：</label>
						<div class="col-sm-9">
							<select class="form-control" id="type" name="type">
								<option value="1">支出</option>
								<option value="2">收入</option>
							</select>
						</div>
					</div>
					<div class="form-group sub_subject">
						<label class="col-sm-2 control-label">科目：</label>
						<div class="col-sm-9">
							<select class="form-control" id="sub_subject" name="sub_subject">
								<!-- <option value="加油总数">加油总数</option>
								<option value="伙食总数">伙食总数</option>
								<option value="工资总数">工资总数</option> -->
								<option value="加油">加油</option>
								<option value="伙食">伙食</option>
								<option value="住宿">住宿</option>
								<option value="工资">工资</option>
								<option value="租金">租金</option>
								<option value="水电">水电</option>
								<option value="杂支">杂支</option>
								<option value="税金">税金</option>
							</select>
						</div>
					</div>
					<div class="form-group user_id">
						<label class="col-sm-2 control-label">人员：</label>
						<div class="col-sm-9">
							<select class="form-control" id="user_id" name="user_id">
								{volist name='user_list' id='item'}
									<option value="{$item.user_id}">{$item.name}</option>
								{/volist}
							</select>
						</div>
					</div>
					<div class="form-group amount">
						<label class="col-sm-2 control-label">金额：</label>
						<div class="col-sm-9">
							<input type="text" id="amount" value="{$info.amount}" name="amount" class="form-control" placeholder="请输入金额">
						</div>
					</div>
					<div class="form-group note">
						<label class="col-sm-2 control-label">备注：</label>
						<div class="col-sm-9">
							<input type="text" id="note" value="{$info.note}" name="note" class="form-control" placeholder="请输入备注">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">日期：</label>
						<div class="col-sm-9"><input type="text" id="created_time" value="{if condition=" $info.created_time neq ''"}{$info.created_time|date="
							Y-m-d"}{/if}" name="created_time" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
							placeholder="请输入日期">
						</div>
					</div>
				<!-- form end -->
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" onclick="{if condition="$info.id neq ''"}CodeInfoDlg.update(){else/}CodeInfoDlg.add(){/if}" id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/static/js/admin/otherExpense.js?t=<?php echo rand(1000,9999)?>" charset="utf-8"></script>
<!-- <script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script> -->
<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
<script>
layui.config({dir: '__PUBLIC__/static/js/plugins/layui/'});
	layui.use(['layer', 'form'], function () {
	window.layer = layui.layer;
	window.form = layui.form();
});
layui.use('element', function(){
	var element = layui.element();
	element.on('tab(test)', function(elem){
	});
});

var images4 = $("#jsrbankimg").val();
default_value4 = getDefaultVal(images4);
uploader('jsrbankimg_upload','jsrbankimg','image',true,default_value4,'{:url("admin/Upload/uploadImages")}');
function getDefaultVal(images) {
	var default_value;
	var images = images.substr(0,images.length-1);

	if(images !== ''){
		var images_value;
		if(images.indexOf("|") == -1){
			images_value = '["'+images+'"]';
		}else{
			images_value = JSON.stringify(images.split("|"));
		}
		default_value = images_value;
	}else{
		default_value = '';
	}
	return default_value;
}

$("#name").blur(function(){
	var name =$.trim($(this).val());
	var html='<small class="help-block" id="is_exist" style="display: none;">该介绍人已经存在</small>';
	$(this).parent().append(html);
	if(name!=''){
		$.post("{:url('admin/Record.Introducer/checkName')}",{name:name},function(result){
			if(result.status!='00'){
				$("#is_exist").show();
				$("#name").next().removeClass('glyphicon-ok').addClass('glyphicon-remove');
				$("#name").parent().parent().removeClass('has-success').addClass('has-error');
			}
		});
	}
});

$("#name").keyup(function(){
	var flag=false;
	$(this).nextAll('small').not('#is_exist').each(function(){
		if($(this).is(':visible')){
			flag=true;
		}
	})
	if(flag){
		$("#is_exist").hide();
	}
});
</script>


{/block}
